{% include "base/template_head.html" %}
<link rel="stylesheet" href="/static/css/paging.css">
<!-- <link rel="stylesheet" href="/static/css/bootstrap-duallistbox.css">
<link rel="stylesheet" href="/static/css/bootstrap-multiselect.css">
<link rel="stylesheet" href="/static/css/select2.css"> -->

<script type="text/javascript" src="/static/js/jquery.js"></script>
<script type="text/javascript" src="/static/js/query.js"></script>
<script type="text/javascript" src="/static/js/paging.js"></script>
<!-- <script type="text/javascript" src="/static/js/ace-extra.js"></script> -->



<div class="row">
    <div class="col-lg-12">
        <div class="row">
            <div class="col-lg-12">
            	<div class="page-header">
					<h1>邮件通知管理</h1>
				</div>
	            <!-- <h2 class="header"><b>邮件通知管理</b></h2> -->
	            <ul class="list-unstyled spaced">
	            	<div class="tabbable">
						<ul class="nav nav-tabs" id="myTab">
							<li class="active">
								<a data-toggle="tab" href="#mypublist" onclick="GetLoginList(1,10)">
									<i class="blue ace-icon fa fa-envelope-open bigger-120"></i>
									邮件通知配置
								</a>
							</li>
							<li >
								<a data-toggle="tab" href="#forreview" onclick="GetActionList(1,10)">
									<i class="orange ace-icon fa fa-envelope-o bigger-120"></i>
									邮件通知列表
								</a>			
							</li>
						</ul>

						<div class="tab-content">

							<div id="mypublist" class="tab-pane fade in active">
								<div class="page-header">
									<!-- <h2> -->
										邮箱基本信息
										<small>
											<i class="ace-icon fa fa-angle-double-right"></i>
											Common form elements and layouts
										</small>
									<!-- </h2> -->
								</div>

								<div class="row">
									<div class="col-xs-12">
										<!-- PAGE CONTENT BEGINS -->
										<form class="form-horizontal" role="form">

											<div class="form-group">
												<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 邮箱用户名 </label>

												<div class="col-sm-9">
													<input type="text" id="form-field-1" placeholder="例如：admin@hk515.mail.com" class="col-xs-10 col-sm-5" />
												</div>
											</div>

											<div class="space-4"></div>

											<div class="form-group">
												<label class="col-sm-3 control-label no-padding-right" for="form-field-2"> 邮箱密码 </label>

												<div class="col-sm-9">
													<input type="password" id="form-field-2" placeholder="Password" class="col-xs-10 col-sm-5" />
												</div>
											</div>

											<!-- <div class="clearfix form-actions"> -->
											<div class="form-group">
												<div class="col-md-offset-3 col-md-9">
													<button class="btn btn-info btn-mini" type="button">
														<i class="ace-icon fa fa-check bigger-110"></i>
														邮箱验证
													</button>

													&nbsp; &nbsp; &nbsp;
													<button class="btn btn-mini" type="reset">
														<i class="ace-icon fa fa-undo bigger-110"></i>
														重置输入
													</button>
												</div>
											</div>

											<hr>



										</form>

									</div>
								</div>

								<!-- 申请通知 -->
								<div class="page-header">
									<h1>
										发布通知
										<small>
											<i class="ace-icon fa fa-angle-double-right"></i>
											Common form elements and layouts
										</small>
									</h1>
								</div>

								<div class="row">
									<div class="col-xs-12">
										<!-- PAGE CONTENT BEGINS -->
										<form class="form-horizontal" role="form">
											<!-- <div class="clearfix form-actions"> -->
											<div class="form-group">
												<label class="control-label col-xs-12 col-sm-3">是否启用通知</label>
												<div class="col-xs-3">
													<label>
														<input name="switch-field-1" class="ace ace-switch ace-switch-5" type="checkbox" />
														<span class="lbl"></span>
													</label>
												</div>
											</div>
											<div class="form-group">
												<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 邮箱用户名 </label>

												<div class="col-sm-9">
													<input type="text" id="form-field-1" placeholder="例如：admin@hk515.mail.com" class="col-xs-10 col-sm-5" />
												</div>
											</div>

											<div class="space-4"></div>

											<div class="form-group">
												<label class="col-sm-3 control-label no-padding-right" for="form-field-2"> 邮箱密码 </label>

												<div class="col-sm-9">
													<input type="password" id="form-field-2" placeholder="Password" class="col-xs-10 col-sm-5" />
												</div>
											</div>
										</form>
										</div>
								</div>

								<!-- 审核通知 -->
								<div class="page-header">
									<h1>
										审核通知
										<small>
											<i class="ace-icon fa fa-angle-double-right"></i>
											Common form elements and layouts
										</small>
									</h1>
								</div>

								<div class="row">
									<div class="col-xs-12">
										<!-- PAGE CONTENT BEGINS -->
										<form class="form-horizontal" role="form">
											<!-- <div class="clearfix form-actions"> -->
											<div class="form-group">
												<label class="control-label col-xs-12 col-sm-3">是否启用通知</label>
												<div class="col-xs-3">
													<label>
														<input name="switch-field-1" class="ace ace-switch ace-switch-5" type="checkbox" />
														<span class="lbl"></span>
													</label>
												</div>
											</div>
											<div class="form-group">
												<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 邮箱用户名 </label>

												<div class="col-sm-9">
													<input type="text" id="form-field-1" placeholder="例如：admin@hk515.mail.com" class="col-xs-10 col-sm-5" />
												</div>
											</div>

											<div class="space-4"></div>

											<div class="form-group">
												<label class="col-sm-3 control-label no-padding-right" for="form-field-2"> 邮箱密码 </label>

												<div class="col-sm-9">
													<input type="password" id="form-field-2" placeholder="Password" class="col-xs-10 col-sm-5" />
												</div>
											</div>
										</form>
										</div>
								</div>

								<!-- 测试通知 -->
								<div class="page-header">
									<h1>
										测试通知
										<small>
											<i class="ace-icon fa fa-angle-double-right"></i>
											Common form elements and layouts
										</small>
									</h1>
								</div>

								<div class="row">
									<div class="col-xs-12">
										<!-- PAGE CONTENT BEGINS -->
										<form class="form-horizontal" role="form">
											<!-- <div class="clearfix form-actions"> -->
											<div class="form-group">
												<label class="control-label col-xs-12 col-sm-3">是否启用通知</label>
												<div class="col-xs-3">
													<label>
														<input id="sbutton" name="switch-field-1" class="ace ace-switch ace-switch-5" type="checkbox" onclick="Getstatus()"; />
														<span class="lbl"></span>
													</label>
												</div>
											</div>
											<div class="form-group">
												<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 邮箱用户名 </label>

												<div class="col-sm-9">
													<input type="text" id="form-field-1" placeholder="例如：admin@hk515.mail.com" class="col-xs-10 col-sm-5" />
												</div>
											</div>

											<div class="space-4"></div>

											<div class="form-group">
												<label class="col-sm-3 control-label no-padding-right" for="form-field-2"> 邮箱密码 </label>

												<div class="col-sm-9">
													<input type="password" id="form-field-2" placeholder="Password" class="col-xs-10 col-sm-5" />
												</div>
											</div>
										</form>
										</div>
								</div>

							</div>

							<div id="forreview" class="tab-pane fade">
								<span style="float: left;color: green"><b>&nbsp;总记录数&nbsp;<span id='previewlistcount'></span>&nbsp;条</b></span>
								<div class="nav-search" style="float: right;">
									<span class="input-icon">
									<input type="text" placeholder="Search ..." class="nav-search-input" id="nav-search-input" autocomplete="off" />
									<i class="ace-icon fa fa-search nav-search-icon"></i>
									</span>
								</div>
								<br>
								<hr>
								<div class="widget-body">
			                        <div class="widget-main no-padding">
			                            <table class="table table-bordered table-striped">
			                                <thead class="thin-border-bottom">
			                                    <tr>
			                                        <th><i class="ace-icon fa fa-caret-right blue"></i>操作日志ID</th>
			                                        <th><i class="ace-icon fa fa-caret-right blue"></i>操作人员</th>
			                                        <th><i class="ace-icon fa fa-caret-right blue"></i>操作时间</th>
			                                        <th><i class="ace-icon fa fa-caret-right blue"></i>操作类型</th>
			                                        <th><i class="ace-icon fa fa-caret-right blue"></i>操作模块</th>
			                                        <th><i class="ace-icon fa fa-caret-right blue"></i>操作备注</th>
			                                    </tr>
			                                </thead>

			                                <tbody id= 'previewlist'>
			                                </tbody>
			                            </table>

			                        </div>
			                    </div>
			                    <br>
								<hr>			                    
			                    <div id="pageToolbar"></div>
							</div>

							<!-- <div id="pageToolbar"></div> -->
						</div>

					</div>



				</ul>
            </div>
        </div>
    </div>


</div>
{% include "base/template_footer.html" %}
<script>
 


	function Getstatus(){
		console.log($("#sbutton").val())
	}

	$(document).ready(function(){
		GetLoginList(1,10);
	});

	function GetLoginList(s_page,page_size) {
		//取出单页数据
		function GetLoginListInfo(s_page,page_size){
			$.ajax({
				type:'POST',
				url:'/log/GetLoginList/',
				data:{'s_page':s_page,'page_size':page_size},
				dataType:'json',
				success:function(val){
					console.log(val)
					console.log(val.LogQsetList)
					var detail = val.LogQsetList
					// $("#mypublistcount").html(val.page_total)
					if(detail.length==0){
						$("#publishlist").html('<tr><td colspan="9" style="text-align:center;">当前无记录</td></tr>')
					}else{
						$("#publishlist").html("")
					}
					// $('#mypublistcount').html(detail.length)

					for (var i=0;i < detail.length;i++){
						// $("#per_publish_user").html(val.review_data[i].publish_user)
						// console.log(val.review_data[i].publish_user)
						var publish_id = detail[i]['id']
					
					$("#publishlist").append("<tr>\
							<td id='publish_"+(publish_id)+"_id'></td>\
							<td id='publish_"+(publish_id)+"_Loginuser'></td>\
							<td id='publish_"+(publish_id)+"_Logintime'></td>\
							<td id='publish_"+(publish_id)+"_Logouttime'></td>\
							<td id='publish_"+(publish_id)+"_Logaction'></td></tr>")

					//加载数据

					$("#publish_"+(publish_id)+"_id").html('<span class="badge">'+publish_id+'</span>')
					$("#publish_"+(publish_id)+"_Loginuser").html(detail[i].Loginuser)
					$("#publish_"+(publish_id)+"_Logintime").html(detail[i].Logintime)
					$("#publish_"+(publish_id)+"_Logouttime").html(detail[i].Logouttime)
					$("#publish_"+(publish_id)+"_Logaction").html(detail[i].Logaction)
					}
				},error:function(){
					console.log('error')
				}
			});		
		};

		//取出总页数
		$.ajax({
			type:'POST',
			url:'/log/GetLoginPageCount/',
			dataType:'text',
			success:function(val){
				$('#mypublistcount').html(val)
				// console.log(val)
				GetLoginListInfo(s_page,page_size);

				//加载页码
				$('#pageToolbar').html("");
				$('#pageToolbar').Paging({pagesize:10,count:val,callback:function(page,size,count){
					//page:当前选择页码
					//size:当前每页显示数量
					//count：当前页码总数(含有多少个size)
					GetLoginListInfo(page,10)
					}
				});
			},error:function(){
				console.log('error')
			}
		});	

	};

	function GetActionList(s_page,page_size) {
		//取出单页数据
		function GetActionListInfo(s_page,page_size){
			$.ajax({
				type:'POST',
				url:'/log/GetActionList/',
				data:{'s_page':s_page,'page_size':page_size},
				dataType:'json',
				success:function(val){
					console.log(val)
					var detail = val.ActionQsetList
					// $("#previewlist").html("")
					// $('#previewlistcount').html(detail.length)
					if(detail.length==0){
						$("#previewlist").html('<tr><td colspan="9" style="text-align:center;">当前无记录</td></tr>')
					}else{
						$("#previewlist").html("")
					}
					for (var i=0;i < detail.length;i++){
						// $("#per_publish_user").html(val.review_data[i].publish_user)
						// console.log(val.review_data[i].publish_user)
						var review_id = detail[i]['id']
					
					$("#previewlist").append("<tr>\
							<td id='review_"+(review_id)+"_id'></td>\
							<td id='review_"+(review_id)+"_Actionuser'></td>\
							<td id='review_"+(review_id)+"_Actiontime'></td>\
							<td id='review_"+(review_id)+"_Actiontype'></td>\
							<td id='review_"+(review_id)+"_Actionmodule'></td>\
							<td id='review_"+(review_id)+"_Actioninfo'></td></tr>")

					//加载数据

					$("#review_"+(review_id)+"_id").html('<span class="badge">'+review_id+'</span>')
					$("#review_"+(review_id)+"_Actionuser").html(detail[i].Actionuser)
					$("#review_"+(review_id)+"_Actiontime").html(detail[i].Actiontime)
					$("#review_"+(review_id)+"_Actiontype").html(detail[i].Actiontype)
					$("#review_"+(review_id)+"_Actionmodule").html(detail[i].Actionmodule)
					$("#review_"+(review_id)+"_Actioninfo").html(detail[i].Actioninfo)
					
					}
					// $('#pageToolbar').html("");
					// $('#pageToolbar').Paging({pagesize:10,count:detail.length,callback:function(page,size,count){alert('1')}});

				},error:function(){
					console.log('error')
				}
			})			
		};

		//取出总页数
		$.ajax({
			type:'POST',
			url:'/log/GetActionPageCount/',
			dataType:'text',
			success:function(val){
				$("#previewlistcount").html(val);
				GetActionListInfo(s_page,page_size);
				//加载页码
				$('#pageToolbar').html("");
				$('#pageToolbar').Paging({pagesize:10,count:val,callback:function(page,size,count){
					//page:当前选择页码
					//size:当前每页显示数量
					//count：当前页码总数(含有多少个size)
					GetActionListInfo(page,10)
					}
				});
			},error:function(){
				console.log('error')
			}
		});		


	};





	
</script>

<!-- 	</body>
</html> -->